package cn.iocoder.yudao.module.def.dal.mysql.equipmentinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.def.dal.dataobject.equipmentinfo.EquipmentInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.def.controller.admin.equipmentinfo.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 设备信息 Mapper
 *
 * @author 系统内置账号23
 */
@Mapper
public interface EquipmentInfoMapper extends BaseMapperX<EquipmentInfoDO> {

    default PageResult<EquipmentInfoDO> selectPage(EquipmentInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EquipmentInfoDO>()
                .eqIfPresent(EquipmentInfoDO::getDeviceType, reqVO.getDeviceType())
                .likeIfPresent(EquipmentInfoDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(EquipmentInfoDO::getBrandModel, reqVO.getBrandModel())
                .eqIfPresent(EquipmentInfoDO::getConstructionUnit, reqVO.getConstructionUnit())
                .eqIfPresent(EquipmentInfoDO::getUserUnit, reqVO.getUserUnit())
                .eqIfPresent(EquipmentInfoDO::getPurpose, reqVO.getPurpose())
                .eqIfPresent(EquipmentInfoDO::getDeploymentLocation, reqVO.getDeploymentLocation())
                .eqIfPresent(EquipmentInfoDO::getCoverageRange, reqVO.getCoverageRange())
                .eqIfPresent(EquipmentInfoDO::getConstructionUsageStatus, reqVO.getConstructionUsageStatus())
                .eqIfPresent(EquipmentInfoDO::getReportingUnit, reqVO.getReportingUnit())
                .eqIfPresent(EquipmentInfoDO::getReporter, reqVO.getReporter())
                .eqIfPresent(EquipmentInfoDO::getContactInfo, reqVO.getContactInfo())
                .eqIfPresent(EquipmentInfoDO::getType, reqVO.getType())
                .orderByDesc(EquipmentInfoDO::getId));
    }

    List<Map<String, Object>> getEquipmentIndex(@Param("projectCates") String[] projectCates,
                                                  @Param("keyword") String keyword,
                                                  @Param("sydw") String[] sydw,
                                                  @Param("jsqy") String[] jsqy,
                                                  @Param("jsdw") String[] jsdw,
                                                  @Param("startYear") String startYear,
                                                  @Param("endYear") String endYear,
                                                  @Param("jsqyArea") String[] jsqyArea);}